% Authors: Francisco Pinto & Bruno Maia
% Date: 22-09-2011
%
% This file is part of "Breakthrough"

% Persistency related predicates

?- ensure_loaded('constants.pro').

% save_game_and_exit/1
% Modes: (+)
% Saves the current game state to a file
save_game_and_exit(State) :-
  save_file(SaveFile),
  open(SaveFile, write, Stream),
  set_output(Stream),
  write(State), write('.'),
  close(Stream),
  halt.

% load_game/1
% Modes: (-)
% Loads the current game state
load_game(State) :-
  save_file(SaveFile),
  open(SaveFile, read, Stream),
  set_input(Stream),
  read(State),
  close(Stream).
